package com.jsbj.user.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.jsbj.tools.DateUtils;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

@Component
public class MybatisObjectHandler implements MetaObjectHandler {

    @Override
    public void insertFill(MetaObject metaObject) {
        setFieldValByName("disabled",0,metaObject);
        setFieldValByName("createTime", DateUtils.getNowDate(),metaObject);
        setFieldValByName("updateTime", DateUtils.getNowDate(),metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        setFieldValByName("updateTime", DateUtils.getNowDate(),metaObject);
        setFieldValByName("disabled",0,metaObject);
    }
}
